Structure

  • Example:

POST /api/v1/users HTTP/1.1
Host: www.example.com
Content-Type: application/json
Content-Length: 56

{
    "name": "João",
    "email": "joao@exemplo.com"
}

  • Contains metadata about the communication such as content type, encoding, content length, cookies, etc.

  • Host: www.example.com

    • Defines the server to which the request is being sent.

  • Content-Type: application/json

    • Indicates that the payload is in JSON format.

  • Content-Length: 56

    • Indicates that the message body has 56 bytes.

Body

  • Contains the actual data being sent. Can be an HTML page, a file, JSON, etc.

  • { "name": "João", "email": "joao@exemplo.com" }

    • This is the actual content of the request. In this case the payload is a JSON object representing the user information to be created on the server.